local roulette = fk.CreateSkill{
    name = "#roulette_active&",
}
Fk:loadTranslationTable{
    ["#roulette_active&"] = "行动",
}
roulette:addEffect("active",{
    max_card_num = 1,
    max_target_num = 1,
    min_card_num = 0,
    min_target_num = 0,
    card_filter = function (self, player, to_select, selected, selected_targets)
        if #selected == 0 then
            local c = Fk:getCardById(to_select)
            if #selected_targets > 0 then
                return player:canUseTo(c,selected_targets[1]) and not player:canUseTo(c, player)
            else
                for index, cp in ipairs(Fk:currentRoom().alive_players) do
                    if player:canUseTo(c,cp) then
                        return true
                    end
                end
            end
        end
    end,
    target_filter = function (self, player, to_select, selected, selected_cards, card, extra_data)
        if #selected == 0 then
            if #selected_cards == 0 then
                return true
            else
                local c = Fk:getCardById(selected_cards[1])
                return player:canUseTo(c,to_select) and not player:canUseTo(c, player)
            end
        end
    end,
    feasible = function (self, player, selected, selected_cards, card)
        if #selected == 1 and #selected_cards == 0 then
            return true
        end
        if #selected_cards > 0 then
            local c = Fk:getCardById(selected_cards[1])
            if player:canUseTo(c,player) then
                return #selected == 0
            elseif #selected > 0 then
                return player:canUseTo(c,selected[1])
            end
        end
        return false
    end,
})

return roulette